<?php

namespace App\Listeners;

use App\Events\RegisterEvent;
use App\Services\Api\ShareCodeServices;
use Illuminate\Contracts\Queue\ShouldQueue;

class GenerateQrListeners
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }



    /**
     * 任务将被发送到的队列的名称
     *
     * @var string|null
     */
    public $queue = 'share-code-listeners';


    /**
     * 任务被处理的延迟时间（秒）
     *
     * @var int
     */
    public $delay = 0;


    /**
     * @param RegisterEvent $event
     * @throws \App\Exceptions\RequestException
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
     * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
     */
    public function handle(RegisterEvent $event)
    {
        (new ShareCodeServices())->generate($event->user);
    }



}
